Namespacing everything to /UVa.
[and.git] / UVa / 11590 - Prefix lookup / gen.cpp
blob8e49303be14a93a9fb89d4c23524a76b23a94f94
1 using namespace std;
2 #include <algorithm>
3 #include <iostream>
4 #include <iterator>
5 #include <sstream>
6 #include <fstream>
7 #include <cassert>
8 #include <climits>
9 #include <cstdlib>
10 #include <cstring>
11 #include <string>
12 #include <cstdio>
13 #include <vector>
14 #include <cmath>
15 #include <queue>
16 #include <deque>
17 #include <stack>
18 #include <list>
19 #include <map>
20 #include <set>
22 template <class T> string toStr(const T &x){ stringstream s; s << x; return s.str(); }
23 template <class T> int toInt(const T &x){ stringstream s; s << x; int r; s >> r; return r; }
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
27 #define D(x) cout << #x " is " << x << endl
30 int main(){
31 srand(time(0));
32 int casos = 1000;
33 while (casos--){
34 int m, n;
35 m = random() % 64 + 1;
36 m = 64;
37 n = random() % 2 + 1;
38 vector<string> prefixes;
40 printf("%d %d\n", n, m);
41 for (int i=0; i<n; ++i){
42 int len = random() % m + 1;
43 string s = "";
44 for (int i=0; i<len; ++i){
45 char c = random() % 2 + '0';
46 s += c;
48 s += "*";
49 prefixes.push_back(s);
50 cout << s << endl;
52 prefixes.push_back("*");
54 int k = (4*n) + 1;
55 k = min(k, 1000);
56 printf("%d\n", k);
57 while (k--){
58 cout << prefixes[random() % prefixes.size()] << endl;
60 cout << endl;
62 puts("0 0");
63 return 0;